package com.elf.zero.step;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.sqlite.db.SupportSQLiteDatabase;

@Database(version = 1, exportSchema = false,
        entities = StepData.class)
public abstract class StepDataBase extends RoomDatabase {

    private static Context mContext;

    public static void init(Context context) {
        mContext = context;
    }

    public static StepDataBase get() {
        return Room.databaseBuilder(mContext, StepDataBase.class, "step_db")
                .allowMainThreadQueries()
                .addCallback(new Callback() {
                    @Override
                    public void onCreate(@NonNull SupportSQLiteDatabase db) {
                        super.onCreate(db);
                        //初始化数据
                    }
                }).build();
    }


    public abstract StepDao getStepDao();
}
